#!/usr/bin/env bash
# Declare a variable
filename="example.txt"
# If filename variable matches regex which ends with .txt or .log then...
if [[ $filename =~ \.(txt|log)$ ]]; then
  echo "File is either a .txt or .log file."
else
  echo "File is not a .txt or .log file."
fi
